package com.mobile.check.beans;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;

import java.util.List;

import com.mobile.check.db.DaoSession;
import com.mobile.check.db.TaskInfoDao;
import com.mobile.check.db.TaskItemInfoDao;


/**
 * 类名: TaskInfo
 * 作者: 李学伟
 * 日期: 2020年10月08日 20:53
 * 描述:
 */
@Entity
public class TaskInfo implements Parcelable {
    @Id
    private Long _ID;
    private long id;
    private String user_id;// "int(11)",  // 用户id
    private String company_id;// "int(11)",  // 企业id
    private String task_name;// "varchar(50)",  // 装置名称
    private String task_img;// "int(11)",  // 装置主图
    private String input_excel;// "varchar(255)",  // 采集excel
    private String input_img;// "varchar(255)",  // 采集图片包
    private String input_time;// "int(11)",  // 采集时间
    @Transient
    private List<String> check_excel;// "varchar(255)",  // 检测excel
    private String check_input_time;// "int(11)",  // 检查录入时间
    private String passback_excel;// "varchar(255)",  // app回传excel
    private String passback_time;// "int(11)",  // app回传时间
    @Transient
    private List<String> recheck_excel;// "varchar(255)",  // 复审excel
    private String recheck_input_time;// "int(11)",  // 复审录入时间
    private String recheck_app_excel;// "varchar(255)",  // 复审app回传
    private String recheck_app_time;// "int(11)",  // 复审回传时间
    private String status;// "1",  // 状态1待采集录入2待回传3复审录入4待复审回传5回传结束
    private String taskFilePath;
    private String exportFilePath;
    @Transient
    private String tmpFilePath;
    @Transient
    private String downUrl;
    private boolean isRepeatTask;
    private int taskType;
    private boolean hadImported;
    private boolean hadDowned;
    private boolean hadUploaded;
    private boolean isLocalFile;
    private boolean isErrorFile;
    private long createTime;

    @ToMany(referencedJoinProperty = "parentId")
    List<TaskItemInfo> itemInfoList;

   

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getCompany_id() {
        return company_id;
    }

    public void setCompany_id(String company_id) {
        this.company_id = company_id;
    }

    public String getTask_name() {
        return task_name;
    }

    public void setTask_name(String task_name) {
        this.task_name = task_name;
    }

    public String getTask_img() {
        return task_img;
    }

    public void setTask_img(String task_img) {
        this.task_img = task_img;
    }

    public String getInput_excel() {
        return input_excel;
    }

    public void setInput_excel(String input_excel) {
        this.input_excel = input_excel;
    }

    public String getInput_img() {
        return input_img;
    }

    public void setInput_img(String input_img) {
        this.input_img = input_img;
    }

    public String getInput_time() {
        return input_time;
    }

    public void setInput_time(String input_time) {
        this.input_time = input_time;
    }

    public List<String> getCheck_excel() {
        return check_excel;
    }

    public void setCheck_excel(List<String> check_excel) {
        this.check_excel = check_excel;
    }

    public String getCheck_input_time() {
        return check_input_time;
    }

    public void setCheck_input_time(String check_input_time) {
        this.check_input_time = check_input_time;
    }

    public String getPassback_excel() {
        return passback_excel;
    }

    public void setPassback_excel(String passback_excel) {
        this.passback_excel = passback_excel;
    }

    public String getPassback_time() {
        return passback_time;
    }

    public void setPassback_time(String passback_time) {
        this.passback_time = passback_time;
    }

    public List<String> getRecheck_excel() {
        return recheck_excel;
    }

    public void setRecheck_excel(List<String> recheck_excel) {
        this.recheck_excel = recheck_excel;
    }

    public String getRecheck_input_time() {
        return recheck_input_time;
    }

    public void setRecheck_input_time(String recheck_input_time) {
        this.recheck_input_time = recheck_input_time;
    }

    public String getRecheck_app_excel() {
        return recheck_app_excel;
    }

    public void setRecheck_app_excel(String recheck_app_excel) {
        this.recheck_app_excel = recheck_app_excel;
    }

    public String getRecheck_app_time() {
        return recheck_app_time;
    }

    public void setRecheck_app_time(String recheck_app_time) {
        this.recheck_app_time = recheck_app_time;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long get_ID() {
        return this._ID;
    }

    public void set_ID(Long _ID) {
        this._ID = _ID;
    }

    public String getTaskFilePath() {
        return taskFilePath;
    }

    public void setTaskFilePath(String taskFilePath) {
        this.taskFilePath = taskFilePath;
    }

    public boolean isHadDowned() {
        return hadDowned;
    }

    public void setHadDowned(boolean hadDowned) {
        this.hadDowned = hadDowned;
    }

    public boolean isRepeatTask() {
        return isRepeatTask;
    }

    public void setRepeatTask(boolean repeatTask) {
        isRepeatTask = repeatTask;
    }

    public String getDownUrl() {
        return downUrl;
    }

    public void setDownUrl(String downUrl) {
        this.downUrl = downUrl;
    }

    public String getTmpFilePath() {
        return tmpFilePath;
    }

    public void setTmpFilePath(String tmpFilePath) {
        this.tmpFilePath = tmpFilePath;
    }

    public boolean getIsRepeatTask() {
        return this.isRepeatTask;
    }

    public void setIsRepeatTask(boolean isRepeatTask) {
        this.isRepeatTask = isRepeatTask;
    }

    public boolean getHadDowned() {
        return this.hadDowned;
    }


    public boolean isHadUploaded() {
        return hadUploaded;
    }

    public void setHadUploaded(boolean hadUploaded) {
        this.hadUploaded = hadUploaded;
    }

    public boolean getHadUploaded() {
        return this.hadUploaded;
    }


    public boolean isLocalFile() {
        return isLocalFile;
    }

    public void setLocalFile(boolean localFile) {
        isLocalFile = localFile;
    }

    public int getTaskType() {
        return taskType;
    }

    public void setTaskType(int taskType) {
        this.taskType = taskType;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this._ID);
        dest.writeLong(this.id);
        dest.writeString(this.task_name);
        dest.writeString(this.input_excel);
        dest.writeString(this.passback_excel);
        dest.writeString(this.recheck_app_excel);
        dest.writeString(this.status);
        dest.writeString(this.taskFilePath);
        dest.writeInt(this.taskType);
        dest.writeByte(this.isLocalFile ? (byte) 1 : (byte) 0);
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1816823028)
    public List<TaskItemInfo> getItemInfoList() {
        if (itemInfoList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            TaskItemInfoDao targetDao = daoSession.getTaskItemInfoDao();
            List<TaskItemInfo> itemInfoListNew = targetDao._queryTaskInfo_ItemInfoList(_ID);
            synchronized (this) {
                if (itemInfoList == null) {
                    itemInfoList = itemInfoListNew;
                }
            }
        }
        return itemInfoList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 473462519)
    public synchronized void resetItemInfoList() {
        itemInfoList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    public boolean getIsLocalFile() {
        return this.isLocalFile;
    }

    public void setIsLocalFile(boolean isLocalFile) {
        this.isLocalFile = isLocalFile;
    }

    protected TaskInfo(Parcel in) {
        this._ID = (Long) in.readValue(Long.class.getClassLoader());
        this.id = in.readLong();
        this.task_name = in.readString();
        this.input_excel = in.readString();
        this.passback_excel = in.readString();
        this.recheck_app_excel = in.readString();
        this.status = in.readString();
        this.taskFilePath = in.readString();
        this.taskType = in.readInt();
        this.isLocalFile = in.readByte() != 0;
    }



    @Generated(hash = 2022720704)
    public TaskInfo() {
    }

    @Generated(hash = 1984449715)
    public TaskInfo(Long _ID, long id, String user_id, String company_id, String task_name,
            String task_img, String input_excel, String input_img, String input_time,
            String check_input_time, String passback_excel, String passback_time,
            String recheck_input_time, String recheck_app_excel, String recheck_app_time, String status,
            String taskFilePath, String exportFilePath, boolean isRepeatTask, int taskType,
            boolean hadImported, boolean hadDowned, boolean hadUploaded, boolean isLocalFile,
            boolean isErrorFile, long createTime) {
        this._ID = _ID;
        this.id = id;
        this.user_id = user_id;
        this.company_id = company_id;
        this.task_name = task_name;
        this.task_img = task_img;
        this.input_excel = input_excel;
        this.input_img = input_img;
        this.input_time = input_time;
        this.check_input_time = check_input_time;
        this.passback_excel = passback_excel;
        this.passback_time = passback_time;
        this.recheck_input_time = recheck_input_time;
        this.recheck_app_excel = recheck_app_excel;
        this.recheck_app_time = recheck_app_time;
        this.status = status;
        this.taskFilePath = taskFilePath;
        this.exportFilePath = exportFilePath;
        this.isRepeatTask = isRepeatTask;
        this.taskType = taskType;
        this.hadImported = hadImported;
        this.hadDowned = hadDowned;
        this.hadUploaded = hadUploaded;
        this.isLocalFile = isLocalFile;
        this.isErrorFile = isErrorFile;
        this.createTime = createTime;
    }

    public static final Creator<TaskInfo> CREATOR = new Creator<TaskInfo>() {
        @Override
        public TaskInfo createFromParcel(Parcel source) {
            return new TaskInfo(source);
        }

        @Override
        public TaskInfo[] newArray(int size) {
            return new TaskInfo[size];
        }
    };
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1276444919)
    private transient TaskInfoDao myDao;

    @Override
    public String toString() {
        return "TaskInfo{" +
                "_ID=" + _ID +
                ", task_name='" + task_name + '\'' +
                ", taskFilePath='" + taskFilePath + '\'' +
                ", isLocalFile='" + isLocalFile + '\'' +
                '}';
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public boolean getIsErrorFile() {
        return this.isErrorFile;
    }

    public boolean isErrorFile() {
        return this.isErrorFile;
    }

    public void setIsErrorFile(boolean isErrorFile) {
        this.isErrorFile = isErrorFile;
    }

    public boolean isHadImported() {
        return hadImported;
    }

    public void setHadImported(boolean hadImported) {
        this.hadImported = hadImported;
    }

    public boolean getHadImported() {
        return this.hadImported;
    }

    public String getExportFilePath() {
        return exportFilePath;
    }

    public void setExportFilePath(String exportFilePath) {
        this.exportFilePath = exportFilePath;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 784127603)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getTaskInfoDao() : null;
    }
}